import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 聚水潭店铺信息信息 */
export interface JustErpBasicShop {
  shopId: number; // 店铺编号
  shopName: string; // 店铺名称
  coId: number; // 公司编号
  shopSite: string; // 店铺站点
  shopUrl: string; // 店铺网址
  created: string | Dayjs; // 创建时间
  nick: string; // 主账号
  sessionExpired: string | Dayjs; // 授权过期时间
  sessionUid: string; // 会话用户编号
  shortName: string; // 店铺简称
  state: boolean; // 状态
  remark: string; // 备注
}

// 聚水潭店铺信息 API
export const JustErpBasicShopApi = {
  // 查询聚水潭店铺信息分页
  getJustErpBasicShopPage: async (params: any) => {
    return await request.get({ url: `/justerp/just-erp-basic-shop/page`, params })
  },

  // 查询聚水潭店铺信息详情
  getJustErpBasicShop: async (id: number) => {
    return await request.get({ url: `/justerp/just-erp-basic-shop/get?id=` + id })
  },

  // 新增聚水潭店铺信息
  createJustErpBasicShop: async (data: JustErpBasicShop) => {
    return await request.post({ url: `/justerp/just-erp-basic-shop/create`, data })
  },

  // 修改聚水潭店铺信息
  updateJustErpBasicShop: async (data: JustErpBasicShop) => {
    return await request.put({ url: `/justerp/just-erp-basic-shop/update`, data })
  },

  // 删除聚水潭店铺信息
  deleteJustErpBasicShop: async (id: number) => {
    return await request.delete({ url: `/justerp/just-erp-basic-shop/delete?id=` + id })
  },

  /** 批量删除聚水潭店铺信息 */
  deleteJustErpBasicShopList: async (ids: number[]) => {
    return await request.delete({ url: `/justerp/just-erp-basic-shop/delete-list?ids=${ids.join(',')}` })
  },

  // 导出聚水潭店铺信息 Excel
  exportJustErpBasicShop: async (params) => {
    return await request.download({ url: `/justerp/just-erp-basic-shop/export-excel`, params })
  },

  // 同步聚水潭店铺信息
  syncJustErpBasicShop: async () => {
    return await request.post({ url: `/justerp/just-erp-basic-shop/syncJustErpShop`})
  },

  treeShopData : async () => {
    return await request.get({ url: `/justerp/just-erp-basic-shop/treeShopData`})
  },


}
